<?php

/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 4.0
 *	LISENSE: FL87MPRYOA0R - http://www.flynax.com/license-agreement.html
 *	PRODUCT: Auto Classifieds
 *	DOMAIN: www.siyaradiali.com
 *	FILE: SEARCH.INC.PHP
 *
 *	This script is a commercial software and any kind of using it must be 
 *	coordinate with Flynax Owners Team and be agree to Flynax License Agreement
 *
 *	This block may not be removed from this file or any other files with out 
 *	permission of Flynax respective owners.
 *
 *	Copyrights Flynax Classifieds Software | 2012
 *	http://www.flynax.com/
 *
 ******************************************************************************/

$reefless -> loadClass('Listings');
$reefless -> loadClass('SearchByDistance', null, 'search_by_distance');

if ( $_GET['request'] == 'sbd' )
{
	$rlSearchByDistance -> loadListingData($_GET['id']);
	exit;
}

$geoData = $_SESSION['GEOLocationData']; 
$rlSmarty -> assign_by_ref('geoData', $geoData);

/* get data from block */
if ( isset($_POST['sbd_block']) )
{
	$country_key = array_search($_POST['block_country'], $rlSearchByDistance -> county_iso);
	$rlSmarty -> assign('sbdStartCountry', $lang['data_formats+name+'.$country_key]);
	$config['sbd_default_distance'] = $_POST['block_distance'];
	$config['sbd_default_units'] = $_POST['block_distance_unit'];
}

/* build sorting bar */
$sorting = array(
	'type' => array(
		'name' => $lang['listing_type'],
		'field' => 'Listing_type',
		'Key' => 'Listing_type',
		'Type' => 'select'
	),
	'category' => array(
		'name' => $lang['category'],
		'field' => 'Category_ID',
		'Key' => 'Category_ID',
		'Type' => 'select'
	),
	'post_date' => array(
		'name' => $lang['join_date'],
		'field' => 'Date',
		'Key' => 'Date'
	)
);
$rlSmarty -> assign_by_ref( 'sorting', $sorting );

/* register xajax functions */
$rlXajax -> registerFunction( array( 'getListings', $rlSearchByDistance, 'ajaxGetListings' ) );